package co.edu.usbcali.modelo.dto;

import co.edu.usbcali.modelo.AreaDesempeno;
import co.edu.usbcali.presentation.backEndBeans.AreaDesempenoView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class AreaDesempenoDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String nombreArea;
    private String codigoArea;
    private boolean rowSelected = false;
    private AreaDesempenoView areaDesempenoView;
    private AreaDesempeno areaDesempeno;

    public AreaDesempeno getAreaDesempeno() {
        return areaDesempeno;
    }

    public String listener_update(ActionEvent e) {
        try {
            areaDesempenoView.action_modifyWitDTO(((codigoArea == null) ||
                codigoArea.equals("")) ? null : new Long(codigoArea),
                ((nombreArea == null) || nombreArea.equals("")) ? null
                                                                : new String(
                    nombreArea));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codigoArea = areaDesempeno.getCodigoArea().toString();
        nombreArea = (areaDesempeno.getNombreArea() != null)
            ? areaDesempeno.getNombreArea().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codigoArea = areaDesempeno.getCodigoArea().toString();
        nombreArea = (areaDesempeno.getNombreArea() != null)
            ? areaDesempeno.getNombreArea().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setAreaDesempeno(AreaDesempeno areaDesempeno) {
        this.areaDesempeno = areaDesempeno;
    }

    public AreaDesempenoView getAreaDesempenoView() {
        return areaDesempenoView;
    }

    public void setAreaDesempenoView(AreaDesempenoView areaDesempenoView) {
        this.areaDesempenoView = areaDesempenoView;
    }

    public String getNombreArea() {
        return nombreArea;
    }

    public void setNombreArea(String nombreArea) {
        this.nombreArea = nombreArea;
    }

    public String getCodigoArea() {
        return codigoArea;
    }

    public void setCodigoArea(String codigoArea) {
        this.codigoArea = codigoArea;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
